package com.mt.mall.entity.skill;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import com.mt.mall.entity.merchant.Shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.mall.entity.good.SpecificationStock;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mt.mall.entity.good.Commodity;

@DEntity(label="秒杀商品",comment="",moduleLabel="秒杀")
@Entity(name="mall_skill_commodity")
@Table(name = "mall_skill_commodity" , indexes = { @Index(name = "index_commodity_id", columnList = "commodity_id"),@Index(name = "index_specifications_id", columnList = "specifications_id")  })
@ApiModel(description = "秒杀商品:")
public class SkillCommodity extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品",component="对象选择",where=false)
	@ApiModelProperty(value = "商品:商品")
	@Column(name="commodity_id",length=255,nullable=false,unique=false)
	private Long commodityId;

	@Transient
	private Commodity commodity;

	@Transient
	@ApiModelProperty(value = "商品名称:商品")
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品")
	private String commodityName;

	@DColumn(index=4,label="规格",foreignEntity="SpecificationStock",comment="将所选择的规格用-拼接",component="对象选择",where=false)
	@ApiModelProperty(value = "规格:将所选择的规格用-拼接")
	@Column(name="specifications_id",length=255,nullable=false,unique=false)
	private Long specificationsId;

	@Transient
	private SpecificationStock specifications;

	@Transient
	@ApiModelProperty(value = "规格名称:将所选择的规格用-拼接")
	@DColumn(index=4,label="规格",foreignEntity="SpecificationStock",comment="将所选择的规格用-拼接")
	private String specificationsName;

	@DColumn(index=5,label="库存",comment="库存",component="数字，整数",where=false)
	@ApiModelProperty(value = "库存:库存")
	@Column(name="stock",length=255,nullable=false,unique=false)
	private Integer stock;

	@DColumn(index=6,label="价格",comment="",component="数字，小数",where=false)
	@ApiModelProperty(value = "价格:")
	@Column(name="price",length=255,nullable=false,unique=false)
	private Double price;

	@DColumn(index=7,label="开始时间",comment="开始时间",component="日期选择",where=false)
	@ApiModelProperty(value = "开始时间:开始时间")
	@Column(name="start_date",length=255,nullable=false,unique=false)
	@JsonSerialize(using = DateSerializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date startDate;

	@DColumn(index=8,label="结束时间",comment="结束时间",component="日期选择",where=false)
	@ApiModelProperty(value = "结束时间:结束时间")
	@Column(name="end_date",length=255,nullable=false,unique=false)
	@JsonSerialize(using = DateSerializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date endDate;

	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息",component="对象选择",where=true)
	@ApiModelProperty(value = "店铺:店铺信息")
	@Column(name="shop_id",length=255,nullable=false,unique=false)
	private Long shopId;

	@Transient
	private Shop shop;

	@Transient
	@ApiModelProperty(value = "店铺名称:店铺信息")
	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息")
	private String shopName;

	public Long getShopId() {
		return shopId;
	}

	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public Long getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}

	public Long getSpecificationsId() {
		return this.specificationsId;
	}

	public void setSpecificationsId(Long specificationsId) {
		this.specificationsId = specificationsId;
	}

	public Integer getStock() {
		return this.stock;
	}

	public void setStock(Integer stock) {
		this.stock = stock;
	}

	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Commodity getCommodity() {
		return this.commodity;
	}

	public void setCommodity(Commodity commodity) {
		if(commodity == null){
		}
		else
		{
		this.commodityId = commodity.getEid();
		this.commodity = commodity;		
		}
}

	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public SpecificationStock getSpecifications() {
		return this.specifications;
	}

	public void setSpecifications(SpecificationStock specifications) {
		if(specifications == null){
		}
		else
		{
		this.specificationsId = specifications.getEid();
		this.specifications = specifications;		
		}
}

	public String getSpecificationsName() {
		return this.specificationsName;
	}

	public void setSpecificationsName(String specificationsName) {
		this.specificationsName = specificationsName;
	}



}
